﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

using Hangjing.Model;
using Hangjing.Common;
using Hangjing.SQLServerDAL;
using Hangjing.WebCommon;

/// <summary>
/// 配送费
/// </summary>
public partial class APP_Android_SaveUserInfo_runsenfee : APIPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Clear();

        StringBuilder json = new StringBuilder("");
        string state = "0";

        ECustomer dal = new ECustomer();


        //发货地址
        string slat = WebUtility.InputText(Request["slat"]);
        string slng = WebUtility.InputText(Request["slng"]);

        //收件地址
        string elat = WebUtility.InputText(Request["elat"]);
        string elng = WebUtility.InputText(Request["elng"]);

        string weight = WebUtility.InputText(Request["weight"]);

        //发件地址
        string address = WebUtility.InputText(Request["address"]);

        //时间
        string sendtime = WebUtility.InputText(Request["sendtime"]);

        HJlog.toLog("sendtime="+ sendtime);

        SendfeeInfo info = new SendfeeInfo();
        info.ShopID = 17;
        info.cityname = "福清市";
        info.sendtime = Convert.ToDateTime(sendtime);


        foreach (var  item in SectionProxyData.GetCityList())
        {
            if (address.IndexOf(item.cname) >=0)
            {
                info.ShopID = item.cid;
                info.cityname = item.cname;
            }
        }

        info.latlng = new latlnginfo();
        info.latlng.ulat = elat;
        info.latlng.ulng = elng;
        info.latlng.slat = slat;
        info.latlng.slng = slng;
        info.weight = Convert.ToDecimal(weight);

        SendFee fee = new SendFee(info);
        SendInfo model = fee.getExpressSendFee();

        Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(model));

        Response.End();
    }
}
